<?php

use yii\db\Migration;

class m180523_030351_alter_customer_field_config extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        //$this->renameColumn('{{%customer_field_config}}', 'site_id','data_type');
        $this->addColumn('{{%customer_field_config}}','data_type',$this->smallInteger(1)->defaultValue(0)->notNull()->comment('数据类型 0 字符串 1 数字'));
        //$this->alterColumn('{{%customer_field_config}}', 'data_type', $this->smallInteger(1)->defaultValue(0)->notNull()->comment('数据类型 0 字符串 1 数字'));
    }

    public function safeDown()
    {
        $this->dropColumn('{{%customer_field_config}}', 'data_type');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180523_030351_alter_customer_field_config cannot be reverted.\n";

        return false;
    }
    */
}
